/**
 * Copyright 2010 Eric Taix
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 * 
 */
package org.jared.synodroid.common.protocol;

import android.os.Message;

/**
 * A interface which define a method to handle response from server
 * @author Eric Taix (eric.taix at gmail.com)
 */
public interface ResponseHandler {
	
	// Specify an update operation occurs
	public static final int MSG_OPERATION_PENDING = 10000;
	// Specify an update operation is finished
	public static final int MSG_OPERATION_DONE = 10001;
	// Show a Toast's message
	public static final int MSG_TOAST = 10002;
	// Specify an error has to be shown
	public static final int MSG_ERROR = 10003;
	// Specify the obj contains task
	public static final int MSG_TASKS_UPDATED = 10004;
	// Connecting to the server
	public static final int MSG_CONNECTING = 10005;
	// Connected to the server
	public static final int MSG_CONNECTED = 10006;
	// Task's details retrieved
	public static final int MSG_DETAILS_RETRIEVED = 10007;
	// Task's files retrieved
	public static final int MSG_DETAILS_FILES_RETRIEVED = 10008;
	// Show a task details
	public static final int MSG_SHOW_DETAILS = 10009;
	// Shared directories retrieved
	public static final int MSG_SHARED_DIRECTORIES_RETRIEVED = 100010;
    // Original file retrieved
    public static final int MSG_ORIGINAL_FILE_RETRIEVED = 100011;


	/**
	 * Handle the response. BE CAREFUL this method will NOT be called from the main thread.
	 * So don't try to interact with the UI. Prefer to use SynodroidActivity subclass and then
	 * implements your code in handleMessage method.
	 * @param msgP
	 */
  public void handleReponse(Message msgP);
  
  /**
   * Return a String according to a ressource id and the current locale
   * @param idP
   * @return
   */
  public String getString(int idP);

  /**
   * Return a String according to a ressource id and the current locale and also replace parameters
   * @param idP
   * @param paramsP
   * @return
   */
  public String getString(int idP, Object... paramsP);
}
